<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
			*{
				margin: 0;
				padding: 0;
			}
			#box{
				position: absolute;
				width: 200px;
				height: 200px;
				background-color: brown;
				left: 150px;
				top: 200px;
			}
		</style>
	</head>
	<body>
		<button id="btn">往右走</button>
		<span id="box"></span>
		
		
		<script src="通用兼容文件.js"></script>
		<script>
			window.onload = function(){
				$('btn').onclick = function(){
					move($('box'), 600,20);
				}
					
				
			};
			
		function move(obj, end, speed){
			clearInterval(obj.timer);
			obj.timer = setInterval(function(){
				obj.style.left = obj.offsetLeft +speed +'px';
				if(obj.offsetLeft >=end){
					clearInterval(obj.timer);
				}
				
			},20);
			
			
		}
			
		</script>
	</body>
</html>
